<?php defined("_JEXEC") or die("acesso restrito"); ?>

<form action="index.php?option=com_sgrh" method="post" enctype="multipart/form-data" >
	<div class="titulosPagina">Consulta de Clientes</div>
	<fieldset>
		<div class="campo">
			<div class="for_label">Contrato / Nome: </div>
			<input class="inputbox menor" type="text" name="numContrato" id="numContrato" maxlength="150" value=""/>
			<button name="task" value="buscar" onclick="submitform()" >
				Buscar
			</button>
		</div>
		
		<!-- Tabela de Clientes-->
		<div id="editcell">
			<table class="lista">
				<thead>
					<tr>
						<th width="10%">
							<?php echo JText::_('N° Contrato'); ?>
						</th>
						<th width="30%">
							<?php echo JText::_('Nome'); ?>
						</th>
						<th width="20%">
							<?php echo JText::_('CNPJ'); ?>
						</th>
						<th width="20%">
							<?php echo JText::_('Cidade'); ?>
						</th>
						<th width="8%">
							<?php echo JText::_('UF'); ?>
						</th>
						<th width="8%">
							<img alt="" src="components/com_sgrh/auxiliares/imagens/selecionar.png" />
						</th>
					</tr>
				</thead>
				<?php
				for ($i = 0; $i < count($this->registros); $i++) {
					$row = & $this->registros[$i];
					$pessoa = & $this->idPessoa;
					$link = JRoute::_("index.php?option=com_sgrh&view=detalhes&idPessoa={$row->id}");
					$linkEditar = JRoute::_("index.php?option=com_sgrh&idPessoa={$row->id}");
					$linkDelete = JRoute::_("index.php?option=com_sgrh&controller=candidato&task=apagarPessoa&idPessoa={$row->id}");
					?>

					<tr class="<?php echo "row" . ($i % 2); ?>">
						<td>
							<a href="<?php echo $link ?>">
								<?php echo $row->nome; ?>
							</a>
						</td>
						<td>
							<?php echo $endereco->cidade; ?>
						</td>
						<td>
							<?php echo $endereco->estado; ?>
						</td>
						<td>
							<?php echo $row->email; ?>
						</td>
						<td>
							<div class="iconesForm" >
								<a class="modal" href="index2.php?option=com_sgrh&view=gerenciador&controller=gerenciador&task=buscarContatos&idPessoa=<?php echo $row->id ?>">
									<img alt="" src="components/com_sgrh/auxiliares/imagens/telephone.png" />
								</a>
							</div>
						</td>
						<td>
							<div class="iconesForm" >
								<a href ="<?php echo $linkEditar; ?>">
									<img alt="" src="components/com_sgrh/auxiliares/imagens/editarDados.png" />
								</a>
							</div>
						</td>
						<?php if ($this->user->gid == 25 ){?>
						<td>
							<div class="iconesForm" >
								<a href="<?php echo $linkDelete; ?>">
									<img alt="" src="components/com_sgrh/auxiliares/imagens/btnRemover.png" />
								</a>
							</div>

						</td>
						<?php } ?>
					</tr>
					<?php
				}
				?>
			</table>
		</div>		
	</fieldset>
</form>
